#include "render_thread.h"

#include "raytracing/raytracer.h"
#include "photonmapping/photontracer.h"

#include "material/texture_material.h"
#include "common/image.h"
#include "qtimage.h"
#include "common/scene.h"

namespace Ui {
	
Render_Thread::Render_Thread(Sirat::Ray_Tracing::Raytracer* _raytracer,Sirat::Photon_Mapping::Photontracer* _photontracer,const unsigned int _sample_photons) : raytracer(_raytracer)  , photontracer(_photontracer) , sample_photons(_sample_photons) { }

void Render_Thread::stop() { raytracer->stop_render(); }

void Render_Thread::run() { 
	if(photontracer != 0) {
		photontracer->trace();
		photontracer->get_photon_map()->photontracer = photontracer;
		raytracer->set_photon_map(photontracer->get_photon_map(),sample_photons);
	}
	
	raytracer->render();  
}

}

